package com.ruoyi.costumeShop.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.costumeShop.domain.CostumeRefundOrderDetail;
import com.ruoyi.costumeShop.service.ICostumeRefundOrderDetailService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * refundOrderDetailController
 * 
 * @author ruoyi
 * @date 2022-04-05
 */
@RestController
@RequestMapping("/costumeShop/refundOrderDetail")
public class CostumeRefundOrderDetailController extends BaseController
{
    @Autowired
    private ICostumeRefundOrderDetailService costumeRefundOrderDetailService;

    /**
     * 查询refundOrderDetail列表
     */
    @PreAuthorize("@ss.hasPermi('costumeShop:refundOrderDetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(CostumeRefundOrderDetail costumeRefundOrderDetail)
    {
        startPage();
        List<CostumeRefundOrderDetail> list = costumeRefundOrderDetailService.selectCostumeRefundOrderDetailList(costumeRefundOrderDetail);
        return getDataTable(list);
    }

    /**
     * 导出refundOrderDetail列表
     */
    @PreAuthorize("@ss.hasPermi('costumeShop:refundOrderDetail:export')")
    @Log(title = "refundOrderDetail", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CostumeRefundOrderDetail costumeRefundOrderDetail)
    {
        List<CostumeRefundOrderDetail> list = costumeRefundOrderDetailService.selectCostumeRefundOrderDetailList(costumeRefundOrderDetail);
        ExcelUtil<CostumeRefundOrderDetail> util = new ExcelUtil<CostumeRefundOrderDetail>(CostumeRefundOrderDetail.class);
        util.exportExcel(response, list, "refundOrderDetail数据");
    }

    /**
     * 获取refundOrderDetail详细信息
     */
    @PreAuthorize("@ss.hasPermi('costumeShop:refundOrderDetail:query')")
    @GetMapping(value = "/{refundOrderDetailId}")
    public AjaxResult getInfo(@PathVariable("refundOrderDetailId") Long refundOrderDetailId)
    {
        return AjaxResult.success(costumeRefundOrderDetailService.selectCostumeRefundOrderDetailByRefundOrderDetailId(refundOrderDetailId));
    }

    /**
     * 新增refundOrderDetail
     */
    @PreAuthorize("@ss.hasPermi('costumeShop:refundOrderDetail:add')")
    @Log(title = "refundOrderDetail", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CostumeRefundOrderDetail costumeRefundOrderDetail)
    {
        return toAjax(costumeRefundOrderDetailService.insertCostumeRefundOrderDetail(costumeRefundOrderDetail));
    }

    /**
     * 修改refundOrderDetail
     */
    @PreAuthorize("@ss.hasPermi('costumeShop:refundOrderDetail:edit')")
    @Log(title = "refundOrderDetail", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CostumeRefundOrderDetail costumeRefundOrderDetail)
    {
        return toAjax(costumeRefundOrderDetailService.updateCostumeRefundOrderDetail(costumeRefundOrderDetail));
    }

    /**
     * 删除refundOrderDetail
     */
    @PreAuthorize("@ss.hasPermi('costumeShop:refundOrderDetail:remove')")
    @Log(title = "refundOrderDetail", businessType = BusinessType.DELETE)
	@DeleteMapping("/{refundOrderDetailIds}")
    public AjaxResult remove(@PathVariable Long[] refundOrderDetailIds)
    {
        return toAjax(costumeRefundOrderDetailService.deleteCostumeRefundOrderDetailByRefundOrderDetailIds(refundOrderDetailIds));
    }
}
